<?php
/* @var $this StkImagenController */
/* @var $model StkImagen */
/* @var $form CActiveForm */
?>

<div class="form">
<div id="content2">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'Stk-imagen-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
      'enableClientValidation'=>true,
        'clientOptions'=>array(
            'validateOnSubmit'=>true,
        )
)); ?>

	<p class="note">Los campos marcados <span class="required">*</span> son requeridos.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'Nombre'); ?>
		<?php echo $form->textField($model,'Nombre',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'Nombre'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'Url'); ?>
		<?php echo $form->FileField($model,'Url'); ?>
          
		<?php echo $form->error($model,'Url'); ?>
	</div>
        <?php if($model->isNewRecord!='1'){ ?>
        <div class="row">
             <?php echo CHtml::image(Yii::app()->request->baseUrl.'/images/uploads/'.$model->Url,"Url",array("width"=>300)); ?>  
           
        </div>
        <?php } ?>

	<script src="<?php echo Yii::app()->baseUrl.'/ckeditor/ckeditor.js'; ?>"></script>

	<div class="row">
		<?php echo $form->labelEx($model,'Texto'); ?>
		 <?php echo $form->textArea($model, 'Texto', array('id'=>'Texto')); ?>
		<?php echo $form->error($model,'Texto'); ?>
	</div>
	<script type="text/javascript">
		CKEDITOR.replace( 'Texto' );
	</script>

	<div class="row">
		<?php echo $form->labelEx($model,'Orden'); ?>
		<?php echo $form->textField($model,'Orden',array('size'=>60)); ?>
		<?php echo $form->error($model,'Orden'); ?>
	</div>


	<div class="row">
		<?php $user=StkUsuario::model()->find('LOWER(NombreUsuario)=?',array( Yii::app()->user->name)); ?>
		<!--<?php echo $form->labelEx($model,'Usuario_Id'); ?>-->
		<!--<?php echo $form->textField($model,'Usuario_Id',array('readonly'=>"readonly", 'value'=>$user->id)); ?>-->
		<!--<?php echo $form->textField($model,'Usuario_Id'); ?>-->
		<?php echo $form->hiddenField($model,'Usuario_Id',array('type'=>"hidden",'readonly'=>"readonly", 'value'=>$user->id)); ?>
		<?php echo $form->error($model,'Usuario_Id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'Categoria'); ?>
		<?php echo $form->dropDownList($model,'Categoria_Id',CHtml::listData(StkCategoria::model()->findAll(),'Id','Nombre'),array('empty'=>'Seleccione')); ?>
		<?php echo $form->error($model,'Categoria_Id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'Producto'); ?>
                <?php echo $form->dropDownList($model,'Producto_Id',CHtml::listData(StkProducto::model()->findAll(),'Id','Nombre'),array('empty'=>'Seleccione')); ?>
		<?php echo $form->error($model,'Producto_Id'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Crear' : 'Guardar', array('class'=>'comment')); ?>
	</div>

<?php $this->endWidget(); ?>
</div>
</div><!-- form -->